package main

import "fmt"

func main() {
	//利用数组输出26个字母，B字符的utf-8编码比A字符大1，类推
	var nums [26]byte
	for i := range nums {
		nums[i] = 'A' + byte(i)
	}
	for _, v := range nums {
		fmt.Printf("%c ", v)
	}

	//求出数组的最大值，并得到下标
	nums2 := [3]int32{4, 2, 10}
	max := nums2[0]
	maxIndex := 0
	for i, v := range nums2 {
		if v > max {
			max = v
			maxIndex = i
		}
	}
	fmt.Println("\n	最大值：", max, "索引：", maxIndex)

	//求出和与平均值
	var sum int32
	for _, v := range nums2 {
		sum += v
	}
	fmt.Println("和：", sum, "平均值：", float64(sum)/float64(len(nums2)))
}
